Skip to content
This repository was archived by the owner on Oct 11, 2023. It is now read-only.

Conversation

@xinyanmsft
Copy link
Contributor

RequestLoggingMiddleware is not aware certain HTTP response can not carry body, such as 204.

Setting body on HTTP 204, 205 and 304 will cause exception as it is not supported, see AspNetCore\src\Servers\Kestrel\Core\src\Internal\Http\HttpProtocol.cs, ThrowWritingToResponseBodyNotSupported.

To repro, run the bike sharing application, go through a bike rental process and check the output of the Gateway container. You will see exception about WritingToResponseBodyNotSupported. The web site appears to still function though.

Fix the issue by skipping setting HTTP body for 204, 205 and 304.

…arry body.

Setting body on HTTP status such as 204 will cause exception. This repros today
already by going through a bike renting flow and examine the logs of Gateway
container. If running under a debugger, the exception will fail the request.

Fix the issue by skipping setting HTTP body for 204, 205 and 304. This is what
asp.net core checks in AspNetCore\src\Servers\Kestrel\Core\src\Internal\Http\
HttpProtocol.cs.
@philon-msft philon-msft merged commit 080910d into Azure:master Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants